home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 033a / medit_.zip / MOUSE.DOC < prev   
Text File  |  1993-04-24  |  4KB  |  90 lines

  1. MEDIT! Graphics Mode Mouse Cursor Editor Program
  2. Robert Brower @1993
  3.  
  4. MOUSE.DOC function call: void mouse(int ax, int bx, int cx, int dx);
  5. explained.
  6.  
  7. You received this program and these files because you were probably
  8. interested in programming the IBM PC mouse. This can be a great skill
  9. to aquire. The mouse enhances any program that uses it. Let me start
  10. by explaining how mouse() works.
  11.  
  12. mouse() accepts 4 integer arguments as you can see from the prototype
  13. above. It sets the CPU general purpose registers AX, BX, CX & DX to
  14. the values that you use in the function call. It generates a software
  15. interrupt. Once this happens the computer will stick values into these
  16. general purpose registers so you can read them and get status. This is
  17. accomplished by means of 4 global integer variables which I have defined
  18. as: Max, Mbx, Mcx, and Mdx. Each time you call mouse() these variables 
  19. will contain new status concerning the call you made. This allows you
  20. to call several functions of the mouse driver by simply setting the 
  21. argument ax to a certain value and inserting other neccessary arguments
  22. in the mouse() call. The following list summarizes most of the more useful
  23. functions. And tells you what you need to se the arguments to for each one.
  24.  
  25. ax=0 bx=0 cx=0 dx=0
  26. This function will initialize the mouse. It's the first step in using
  27. any of the other functions of the mouse driver and must be done prior
  28. to performing any other functions. The values of bx, cx, & dx are actually
  29. ignored so you really don't need to set them to 0, but I do for clarity.
  30. Max will equal -1 when the mouse harware and driver are detected. Other-
  31. wise, Max will equal 0. The number of buttons available is returned in Mbx.
  32.  
  33. ax=1 bx=0 cx=0 dx=0
  34. This may be your next step in using the mouse. It displays it on the 
  35. screen. It will appear as a box in text modes, and as an arrow in graphics
  36. modes. Again, bx, cx & dx are ignored. There is no output when this 
  37. function is called other than the mouse being displayed.
  38.  
  39. ax=2 bx=0 cx=0 dx=0
  40. This function is similar to the previous one, except that this will hide
  41. the mouse. It is still active but it's hidden. This is useful when screen
  42. writes are taking place as the mouse will AND & XOR with pixels written
  43. and could cause irratic looking results. So hide it when you are writing
  44. to the screen and display it when you're finished.
  45.  
  46. ax=3 bx=0 cx=0 dx=0
  47. The X coordinate in pixels is returned in Mcx and the Y coordinate is 
  48. returned in Mdx when this one is called. In 320 x 200 graphics mode,
  49. divide these returned coordinates by 2 to reflect the actual screen
  50. coordinates of the mouse cursor. If a mouse button was pressed since the
  51. last call to mouse() then Mbx will contain the button status where:
  52. bit 0=1: left button was pressed
  53. bit 1=1: right button was pressed
  54. bit 2=1: center button was pressed
  55. bit 3-15: unused
  56.  
  57. ax=4 bx=0 cx=X coordinate dx=Y coordinate
  58. Calling this function puts the mouse cursor at the X,Y location
  59. specified by your cx and dx arguments respectively. bx is ignored.
  60.  
  61. ax=5 bx=0, 1 or 2 cx=0 dx=0
  62. When you use this function, it will return the number of times the specified
  63. mouse button was pressed where bx is:
  64. 0 left
  65. 1 right
  66. 2 center
  67. Mbx will hold the number of times the specified button was pressed since
  68. the last call to mouse(). Mcx and Mdx will hold the X,Y coordinates of
  69. the locations where the last button press took place.
  70.  
  71. ax=6 bx=0, 1 or 2 cx=0 dx=0
  72. Similar to previous call only this applies to button releases instead
  73. of presses.
  74.  
  75. ax=7 bx=0 cx=minimum x dx=maximum x
  76. This call sets horizontal screen limits in which the mouse will be
  77. restricted to. cx and dx are the left and right limits in pixels
  78. respectively.
  79.  
  80. ax=8 bx=0 cx=minimum y dx=maximum y
  81. This call is similar to the previous call only it applies to vertical
  82. restriction of the mouse cursor.
  83.  
  84. There are a few more, more complicated routines that are available. This
  85. should provide a healthy start to mouse programming. However if you need
  86. further information, I can be reached on Structures BBS in Toronto, ONT.
  87. in the C Programmers Conference. (416) 778-4193.
  88.  
  89.                                                 Robert Brower
  90.